package com.cci.zkweb.core.model;

import org.zkoss.zul.Image;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;

import com.cci.zkweb.core.entity.p8.P8Object;

/**
 * Render folder content
 * Define the rendering of the listbox row 
 * that display the folder content
 * @author durzod
 */
public class FolderContentRenderer 
implements ListitemRenderer<P8Object> {
	@Override
	public void render(Listitem item, P8Object data, int index)
	throws Exception {
		// icon
		Listcell imgCell = new Listcell();
		Image img = new Image(data.getIcon());
		img.setParent(imgCell);
		imgCell.setParent(item);
		imgCell.setLabel("");
		
		
		new Listcell(data.getName()).setParent(item);
		new Listcell(data.getDimension()).setParent(item);
		new Listcell(data.getAuthor()).setParent(item);
		new Listcell(data.getClassDoc()).setParent(item);
		new Listcell(data.getMajor()).setParent(item);
		new Listcell(data.getMinor()).setParent(item);
		new Listcell(data.getLastEditor()).setParent(item);
		
		// item.addEventListener(Events.ON_DOUBLE_CLICK, new DoubleClickListener(data));
		item.setValue(data);
	}
}